using System;
using System.Collections.Generic;
using System.Text;

namespace Barrage
{
    /// <summary>
    /// Base abstract class for shaders
    /// </summary>
    public abstract class Shader:IDisposable
    {
        /// <summary>
        /// Returns the number of passes the shader has
        /// </summary>
        /// <param name="material">Material that will be used to render (specifies the technique that will be used)</param>
        /// <returns>Number of passes of the shader technique</returns>
        public abstract int PassNumber(Material material);

        /// <summary>
        /// Begins the render of the specified pass
        /// </summary>
        /// <param name="pass">Pass number</param>
        public abstract void BeginPass(int pass);
        /// <summary>
        /// Ends the render of the current pass
        /// </summary>
        public abstract void EndPass();
        /// <summary>
        /// Begins the render of the specified combination of item / material
        /// </summary>
        /// <param name="item">The rendered item</param>
        /// <param name="material">The material used in the render</param>
        public abstract void BeginRender(Barrage.Item item,Material material);
        /// <summary>
        /// Ends the render of the item
        /// </summary>
        public abstract void EndRender();

        /// <summary>
        /// Clear resources
        /// </summary>
        public virtual void Dispose()
        {
            NLog.LogManager.GetLogger(ToString()).Debug("Disposing");
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Destructor. Clear resources
        /// </summary>
        ~Shader()
        {
            Dispose();
        }
    }
}
